(function() { $(function(){ let Schema = function() { } Schema.prototype = { callSchema : function (schema, path, params){ console.log("callSchema before"); let paramsLength = Object.keys(params).length; let paramsStr = ""; if (params != undefined) { let isFirstPassed = false; for (key in params) { if (!isFirstPassed) { isFirstPassed = true; paramsStr += "?"; } else { paramsStr += "&"; } if (key.toLowerCase() == 'url' || key.toLowerCase() == 'coupon') { paramsStr += key + "=" + encodeURIComponent(params[key]); } else { paramsStr += key + "=" + params[key]; } } } setTimeout(function () { location.href = schema + "://" + path + paramsStr; }, 300); console.log("schema Call:" + schema + "://" + path + paramsStr); console.log("schemaCall after"); } } window.Schema = new Schema(); }); })();